package jy.game.components.wuxue.pojo;


import java.util.ArrayList;
import java.util.List;
import java.util.UUID;

import jy.game.BasePojo;
import jy.game.components.wuxue.JyBuff;
import jy.game.tools.JyResourceManager;
import wx.xml.simpleframework.xml.Attribute;
import wx.xml.simpleframework.xml.ElementList;
import wx.xml.simpleframework.xml.Root;

@Root(name = "aoyi")
public class JyAoyi extends BasePojo {
    @Attribute(name = "name")
    public                                                 String          name;
    @Attribute public                                      String          start;
    @Attribute public                                      int             level;
    @Attribute public                                      double          probability;
    @Attribute public                                      String          buff;
    @Attribute public                                      String          animation;
    @Attribute public                                      double          addPower;
    @ElementList(name = "condition", inline = true) public List<Condition> conditions = new ArrayList<>();

    private String _pk;

    public JyAoyi() {
        this._pk = UUID.randomUUID().toString();
    }

    // (get) Token: 0x06000399 RID: 921 RVA: 0x00003F7C File Offset: 0x0000217C
    @Override public /*override*/ String getPK() {
        {
            return this._pk;
        }
    }

    // (get) Token: 0x0600039A RID: 922 RVA: 0x00003F84 File Offset: 0x00002184
    // [XmlIgnore]
    public Iterable<JyBuff> getBuffs() {
        {
            return JyBuff.Parse(this.buff);
        }
    }

    public double GetStartSkillHard() {
        JySkill skill = JyResourceManager.get(JySkill.class, this.start);
        if (skill != null) {
            return skill.hard;
        }
        JyUniqueSkill uniqueSkill = JyResourceManager.get(JyUniqueSkill.class, this.start);
        if (uniqueSkill != null) {
            return uniqueSkill.hard;
        }
        return 100f;
    }

    @Root(name = "condition")
    static public class Condition {
        @Attribute
        public String type;
        @Attribute
        public String value;
        @Attribute
        public String level;

        //[XmlIgnore]
        public int getLevel() {
            return (this.level != null) ? Integer.parseInt(this.level) : 0;
        }
    }
}
